package com.tqfframe.rabbitmq.controller;

import com.tqfframe.rabbitmq.constants.RabbitConstants;
import com.tqfframe.rabbitmq.service.DelayService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: Qifeng Tang
 * @date: 2022/11/17 11:23
 * @Version 1.0
 **/
@RestController
public class DelayController {
    @Autowired
    RabbitTemplate rabbitTemplate;
    @Autowired
    DelayService delayService;


    /**
     * 发送延迟消息队列
     *  http://localhost:8080/delayMsg
     * @return
     */
    @GetMapping("/delayMsg")
    private String delayMsg(){
//        delayService.sendTimeoutMsg("hello1", RabbitConstants.DELAY_ROUTINGKEY, 2);
        delayService.sendTimeoutMsg2("测试", RabbitConstants.DELAY_ROUTINGKEY, 2);
        System.out.println("发送成功");
        return "11";
    }



}
